折腾了一晚上,在将一个Eclipse项目转移到IDEA中时,发现<c:if>标签始终不起作用,到最后才发现问题出在了web.xml文件中,IDEA默认创建的web.xml文件是这样的:

1
2
3
<web-app>
<display-name>Archetype Created Web Application</display-name>
</web-app>

这样将SpringMVC的环境搭建好后,<c:if>标签不起作用,最后发现如下就可以了:

1
2
3
4
5
6
<web-app xmlns="http://xmlns.jcp.org/xml/ns/javaee"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://xmlns.jcp.org/xml/ns/javaee http://xmlns.jcp.org/xml/ns/javaee/web-app_3_1.xsd"
version="3.1">
<display-name>Archetype Created Web Application</display-name>
</web-app>